#pragma once
#include "math.h"
#include "HRVIndex.h"
#include "QVector"

class ComputeHRV
{
public:
	ComputeHRV(int SampleRate);
	~ComputeHRV();
	void InitHrvParameter(void);

	void SetUserInfo(int age, int sex);

	double Cal_TpScore(double tp, int age, int gender);
	double Cal_MsiScore(double ratio, int age, int gender);
	double CalSdnnScore(double sdnn, int age, int gender);
	double CalPsiScore(double psi, int age, int gender);
	double CalLfScore(double lf, int age, int gender);
	double CalHfScore(double hf, int age, int gender);
	double CalHrtstate(double mean_hrt, int age, int gender);
	double Cal_TotolScore(double psiscore, double sdnnscore, double msiscore);
	double Cal_ANSBalance(double lfnorm, int age, int gender);
	double Cacul_Emotion(double lfhf);

	
	void Cal_MPIndex();
	HRVIndex getResult();
private:

    double Cacul_Psi(QVector<int> rr_buf, int rr_len);
	double* HrvParameters;
	int SampleRate,age,gender;
	HRVIndex hrvIndex;
	
};

